package com.lvyq.javaprint.view.tray;

 import com.lvyq.javaprint.constant.TrayConstant;
import javafx.event.EventHandler;
import javafx.scene.control.Button;
 import javafx.scene.control.ToggleButton;
 import javafx.scene.input.MouseEvent;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
 import javafx.scene.shape.Line;
 import javafx.stage.Stage;
import java.awt.print.PrinterJob;
 import java.io.IOException;


/**
 * @author lvyq
 * @version 1.0
 * Create by 2024-04-28 10:09
 */
public class TrayButtonView {

    /**
     * @description  创建操作菜单
     * @author lvyq
     * @throws
     * @return VBox 
     * @time 2024-04-29 11:15
     */
    public static BorderPane createOperateMenu(Stage trayStage) {
        BorderPane borderPane = new BorderPane();
        //中间操作
        borderPane.setCenter(createCenterView());
        //底部按钮
        borderPane.setBottom(createBottomView(trayStage));
        return borderPane;
    }

    /**
     * @description 创建中间操作
     * @author lvyq
     * @throws
     * @return Node
     * @time 2024-04-29 14:14
     */
    private static VBox createCenterView( ) {
        VBox vBox = new VBox();
        Button helpBut = CenterView.createHelpBut();
        Button versionBut = CenterView.createVersionBut();

        //开机自启
        HBox selfStartBox = null;
        try {
            selfStartBox = CenterView.createSelfStartBut();
        } catch (IOException |RuntimeException|InterruptedException e) {
            e.printStackTrace();
        }

        //设置字体
        vBox.setStyle("-fx-font-size: 13px;");
        // 添加分割线
        Line line = new Line();
        line.setStartX(0);
        line.setEndX(200); // 设置分割线的长度
        line.setStyle("-fx-stroke: #CCCCCC;"); // 设置分割线的颜色

         Button button= new Button();
         button.setPrefWidth(TrayConstant.TRAY_STAGE_WIDTH);
         button.setText("打印控件");
        vBox.getChildren().addAll(button,helpBut,versionBut,line,selfStartBox);

        return vBox;
    }

    /**
     * @description 创建底部按钮
     * @author lvyq
     * @throws
     * @return HBox
     * @time 2024-04-29 11:57
     */
    private static HBox createBottomView(Stage trayStage) {
        HBox hBox = new HBox();
        Button exitBut = BottomView.createExitBut(trayStage);
        Button feedBackBut =  BottomView.createFeedBackBut();
        hBox.getChildren().addAll(feedBackBut,exitBut);
        return hBox;
    }

}
